<?php
require 'libs/ModelBase.php';
class herramientasModel extends ModelBase
{
	public function getRol(){
		
		$consulta = $this->db->prepare("SELECT * FROM rol");
 		$consulta->execute();
		
		return $consulta;
	}
	
	public function addUser($user, $pass, $name, $rol){
		
		$consulta = $this->db->prepare("INSERT INTO usuario
				                        VALUES ('$user', '$pass', '$name', '$rol')");
		
 		if ($consulta->execute()) {
 			return "SI";
 		}else{
 			return "NO";
 		}
	}
	
	public function getUsers(){
		
		$consulta = $this->db->prepare("SELECT usuario . * , rol.Description
										FROM usuario
										INNER JOIN rol ON usuario.rol = rol.idRol");
		$consulta->execute();
		
		return $consulta;
	}

}
?>